import {api} from "@/utils/request";

const api_name = '/product/product'

// 分页列表
export const GetProductPageList = (page:number, limit:number, queryDto:any) => {
  return api({
    url: `${api_name}/${page}/${limit}`,
    method: 'get',
    params: queryDto,
  })
}


// 保存信息
export const SaveProduct = (product:any) => {
  return api({
    url: `${api_name}/save`,
    method: 'post',
    data: product,
  })
}

// 修改信息
export const UpdateProductById = (product:any) => {
  return api({
    url: `${api_name}/updateById`,
    method: 'put',
    data: product,
  })
}

// 根据id获取信息
export const GetProductById = (id:number) => {
  return api({
    url: `${api_name}/getById/${id}`,
    method: 'get',
  })
}


// 根据id删除商品
export const DeleteProductById = (id:number) => {
  return api({
    url: `${api_name}/deleteById/${id}`,
    method: 'delete',
  })
}


//审核
export const UpdateProductAuditStatus = (id:number, auditStatus:any) => {
  return api({
    url: `${api_name}/updateAuditStatus/${id}/${auditStatus}`,
    method: 'get',
  })
}

//上下架
export const UpdateProductStatus = (id:number, status:any) => {
  return api({
    url: `${api_name}/updateStatus/${id}/${status}`,
    method: 'get',
  })
}


// 导出excel
export const ExportProductData  = () => {
  return api({
    url: "product/product/exportData",
    method: 'get',
    responseType: 'blob'  // // 这里指定响应类型为blob类型,二进制数据类型，用于表示大量的二进制数据
  })
}



